<!-- 处理按钮组 -->

<template>
  <el-dropdown placement="bottom-start" :disabled="!inited" @command="toDeal">
    <BtnDefault><span>批量处理</span><i class="el-icon-arrow-down" /></BtnDefault>

    <template #dropdown>
      <el-dropdown-menu>
        <el-dropdown-item v-for="item in DICT.DEAL" :key="item[0]" :command="item[0]">{{ item[1] }}</el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'BtnsDeal',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixModal('deal', 'deal_')],

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 点击处理
     */
    async toDeal(status) {
      const { DICT, param, deal_openEdit } = this

      if (!param.idList.length) {
        CORE.MSG.warning(`请选择${CORE.MAP.ASSET}`)
        return
      }

      deal_openEdit({
        TIP: `批量${CORE.dict(DICT.DEAL, status)}`,
        assetId: param.idList,
        operateType: status,
        userId: CORE.USER.uaaUserId,
        userName: CORE.USER.name,
      })
    },
  },
}
</script>
